/**
 * 
 */
package com.videoshare.multimedia;

/**
 * @author Administrator
 *
 */
import java.sql.Connection;

import javax.servlet.http.*;

import org.apache.struts.action.*;
import org.apache.commons.logging.*;

import com.hp.hpl.jena.rdf.model.Model;
import com.sapientia.rdfmodel.PersistentRDF;
import com.sapientia.rdfmodel.bean.*;

import java.util.*;

public class MultimediaContentAction extends Action
{
private static Log log = LogFactory.getLog(MultimediaContentAction.class);
	
	public ActionForward execute(
			ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception
	{
		PersistentRDF pRDF = new PersistentRDF();
		Connection conn = getDataSource(request,"dataDB").getConnection();
		
		Model model = pRDF.createModel("http://www.sapientia.tv",conn);
		
		List resourceList = pRDF.sparqlModel(model);
		
		MultimediaContentForm resourceForm = (MultimediaContentForm)form;
		
		request.setAttribute("resources",resourceList);
		
		resourceForm.setResource(resourceList);
		
		return mapping.findForward("success");
	}

}
